package com.liangzhong.modules.shop.command
{
	import com.liangzhong.proxy.shop.ShopProxy;
	import com.liangzhong.proxyconstant.shop.ShopProxyConstant;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	public class ShopCommand extends SimpleCommand
	{
		public function ShopCommand()
		{
			super();
		}
		override public function execute(notification:INotification):void
		{
			var clubProxy:ShopProxy = facade.retrieveProxy(ShopProxy.PROXYNAME) as ShopProxy;
			//			var userId:int = AppData.getInstance().user.uid;  						//登录的uid
			//			var userKey:String = AppData.getInstance().user.key;					//验证码
			//			var clubId:int = AppData.getInstance().user.userDetailInfo.cid;
			switch(notification.getName())
			{
				case ShopProxyConstant.SHOPMEDTOCOMMAND:
					mediatorNotification(notification);
					
					break;
			}
		}
		/**
		 * clubMediator -->clubCommand 通知
		 * @param notification
		 * 
		 */		
		private function mediatorNotification(notification:INotification):void
		{
			var clubProxy:ShopProxy = facade.retrieveProxy(ShopProxy.PROXYNAME) as ShopProxy;
			switch(notification.getType())
			{
				case ShopProxyConstant.SHOP_BUY:
					clubProxy.requestBuyGoods(notification.getBody());
					break;
				case ShopProxyConstant.SHOPLIST:
					clubProxy.requestShopList();
					break;
			}
		}
	}
}